<%-- 
    Document   : moblieDetail
    Created on : 2016-9-23, 16:03:39
    Author     : 52461
--%>

<%@page import="com.cxhd.pacs.DataConfig"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=0.6">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><%=DataConfig.getInstance().getConfig().get("systemName")%></title>
        <link rel="icon" href="${base}/favicon.ico" type="image/x-icon">
        <link href="${base}/css/bootstrap-paper.css" rel="stylesheet">
        <link href="${base}/css/font-awesome.css" rel="stylesheet">
        <link href="${base}/css/datepicker3.css" rel="stylesheet">
        <link href="${base}/css/mobileDetail.css" rel="stylesheet">
<!--        <link href="${base}/css/layer.css" rel="stylesheet">-->
        <link href="${base}/css/nprogress.css" rel="stylesheet">
        <script type="text/javascript" src="${base}/js/jquery-1.9.1.js"></script>
        <script type="text/javascript" src="${base}/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="${base}/js/angular/angular.min.js"></script>
        <script type="text/javascript" src="${base}/js/nprogress.js"></script>
        <script type="text/javascript" src="${base}/js/mi.js"></script>
        <script type="text/javascript" src="${base}/js/jquery.cxhd.js"></script>
        <script type="text/javascript" src="${base}/js/bootstrap-datepicker.js"></script>
        <script type="text/javascript" src="${base}/js/bootstrap-datepicker.zh-CN.js"></script>
        <script type="text/javascript" src="${base}/js/layer.js"></script>
        <script src="${base}/js/angular/ui-bootstrap-tpls-0.12.0.min.js"></script>
        <script type="text/javascript" src="${base}/js/angular-base.js"></script>
    </head>
    <body ng-app="moblieDetail" ng-controller="mainCtrl">
        <!--头部菜单-->
        <header class="app-header-fixed  navbar navbar-static-top" id="top">
            <a href="" class="navbar-brands"><%=request.getAttribute("patientName")%></a>
        </header>
        <!--左侧菜单-->
        <div class="app-aside">
            <ul class="app-li">
                <li  class="">
                    <a href="">
                        <!--<b class="badge bg-info pull-right">9</b>-->
                        <i class=" fa fa-home fa-4x"></i>

                    </a>
                </li>

                <li  class="" ng-click="searchData('DX')">
                    <a href="">
                        <!--                        <b class="badge bg-info pull-right">9</b>-->
                        <i class="">DX</i>
                    </a>
                </li>
                <li  class="" ng-click="searchData('US')">
                    <a href="">
                        <!--<b class="badge bg-info pull-right">9</b>-->
                        <i class="">US</i>
                    </a>
                </li>
                <li  class="" ng-click="searchData('CT')">
                    <a href="">
                        <!--<b class="badge bg-info pull-right">9</b>-->
                        <i class="">CT</i>
                    </a>
                </li>
                <li  class="" ng-click="searchData('MRI')">
                    <a href="">
                        <!--<b class="badge bg-info pull-right">9</b>-->
                        <i class="">MRI</i>
                    </a>
                </li>
                <li  class="" ng-click="searchData('病历')">
                    <a href="">
                        <!--<b class="badge bg-info pull-right">9</b>-->
                        <i class="">病历</i>
                    </a>
                </li>
                <li  class="" ng-click="searchData('心电')">
                    <a href="">
                        <!--<b class="badge bg-info pull-right">9</b>-->
                        <i class="">心电</i>
                    </a>
                </li>
                <li  class="" ng-click="searchData('其他文档')">
                    <a href="">
                        <!--<b class="badge bg-info pull-right">9</b>-->
                        <i class="">文档</i>
                    </a>
                </li>
                <li  class="" ng-click="searchData('远程报告')">
                    <a href="">
                        <!--<b class="badge bg-info pull-right">9</b>-->
                        <i class="">报告</i>
                    </a>
                </li>
            </ul>
        </div>

        <div class="detail-content">
            <ul>
                <li ng-repeat="item in details" ng-click="openConfr(item)">
                    <div class="detail-header text-success" ng-bind="item.event_name">

                    </div>
                    <div class="detail-date" ng-bind="item.event_time.split(' ')[0]"></div>
                    <div style="clear: both"></div>
                    <div class="detail-description" ng-bind="item.event_description">

                    </div>
                </li>
            </ul>

        </div>


        <div class="lay-bg x" onclick="hide_lay()">
            <div style="float: right;width: 60px;height: 60px; z-index: 1000;background: white" ><span class="fa fa-4x fa-close"></span></div>
        </div>
        <div id="lay_content" class="lay-content x">
            <!--<div style="width: 100%;"><button ng-click="openScreenModal()" class="btn btn-info btn-xs">在工作站打开</button></div>-->
            <div id="myRpt" style="height: 100%;position: relative;overflow: auto; margin-top: 10px;">
                <div ng-if="item.result_type == 'image'" id="mod2"  class="mod-2" style="width: 100%">

                <img  ng-repeat="rimage in resultImages" ng-click="selectOneImage('image' + $index)" style="display: block;max-width: 100%;margin-left: auto;margin-right: auto;max-height: 100%" id="image{{$index}}" ng-src="{{rimage}}" alt="">

            </div>
            <div ng-if="item.result_type == 'text'" id="mod1" class="mod-1" style="font-size: 18px;overflow: auto">
                <table class="table">
                    <tr ng-repeat="re in results">
                        <td ng-bind="re"></td>
                    </tr>
                </table>

            </div>
            <div  ng-if="item.result_type == 'table' && item.data_type == 'lis_detail'" id="mod3"  class="mod-3" style="max-width: 600px;font-size: 12px;overflow: auto;font-size: 14px; display: none">
                <table width="100%" style="border-spacing:0px">
                    <tr>
                        <td colspan="5" align="right" >时间：{{lisResults[0].date_test}}</td>
                    </tr>
                    <tr class="xl_head">
                        <th align="center">简称</th>
                        <th align="center">检验项目</th>
                        <th align="center">结果</th>
                        <th align="center">备注</th>
                        <th align="center">参考范围</th>
                        <th align="center">单位</th>
                    </tr>
                    <tr ng-repeat="re in lisResults">
                        <td align="left" ng-bind="re.item_code"></td>
                        <td align="left" ng-bind="re.item_name"></td>
                        <td align="left"  ng-bind="re.test_value"></td>
                        <td align="left"  ng-bind="re.text_note"></td>

                        <td align="left"  ng-bind="re.text_range"></td>
                        <td align="left"  ng-bind="re.text_danwei"></td>
                    </tr>
                </table>

            </div>

            <div ng-if="item.result_type == 'html'" id="mod4"  class="mod-4" style="overflow-x: hidden;overflow-y: auto; ">


            </div>
            <!--<iframe id="pdf_src" ng-if="item.result_type == 'pdf'" id="mod5" ng-src="{{pdfSrc}}" frameBorder=0 scrolling=auto width="100%" height="100%"  class="mod-5"   style="overflow-x: hidden;overflow-y: auto;position: relative">-->
                 <div ng-if="item.result_type == 'pdf'" id="mod5"  class="mod-5" style="width: 100%">

                <img  ng-repeat="rimage in pdfImages"  style="display: block;max-width: 100%;margin-left: auto;margin-right: auto;max-height: 100%" id="image{{$index}}" src="getPdfImage?path={{rimage}}" alt="">

            </div>

            <!--</iframe>-->
            <video ng-if="item.result_type == 'video'" id="mod6" width="100%" controls=""  ng-src="{{videoSrc}}"></video>
            </div>
        </div>
        <div class="workstation">
            <div style="float: right;margin-bottom: 20px;"> <span onclick="$('.workstation').hide()" class="fa fa-close" style="font-size: 24px"></span></div>
            <div style="clear: both"></div>
            <button type="button" ng-repeat="item in screens" ng-click="openInScreen(item)" class="btn btn-success btn-lg btn-block">{{item.name}}</button>

        </div>
    </body>
</html>

<script>


    function hide_lay() {
        //conosle.log("---------------");
        $(".x").hide();
    }
    angular.module('moblieDetail', ['baseModule'])
            .controller("mainCtrl", function ($scope, base) {
                $scope.host_id = "<%=request.getAttribute("host_id")%>";
                $scope.user_phone = "<%=request.getAttribute("doctor_phone")%>";
               
             
                $scope.getDetail = function () {
                    base.post("getMobileDetail", {host_id: $scope.host_id}).get(function (data) {
                        $scope.details = data;
                    })
                };
                $scope.openScreenModal = function () {

                    $(".workstation").show();
                }
                $scope.openConfr = function (item) {



//                    var r = confirm("在电脑上打开吗？");
//                    if (r == true)
//                    {
//                        base.post("getResultItem", {result_pk: item.pk}).get(function (data) {
//                            $scope.item = data;
//                            var item = data;
//                            $scope.openScreenModal();
//                        })
//                    } else
//                    {
                    $scope.getResult(item);
                    //}

//
//                    steveConfrim("在电脑上打开吗？", function () {
//                      
//
//
//                    }, function () {
//                       
//
//                    })
                }
                $scope.getResult = function (item) {
                    $(".x").show();
                    base.post("getResultItem", {result_pk: item.pk}).get(function (data) {
                        $scope.item = data;
                        var item = data;

                        $scope.showTitle = item.event_name;
                        if (item.result_type == "image") {
                            $scope.imageDetailStatus = true;
                            $scope.showId = "mod2";
                            $scope.resultImages = item.event_result.split(",");
                            for (var i in $scope.resultImages) {
                                $scope.resultImages[i] = "getImage?fileId=" + $scope.resultImages[i];
                            }

                        } else if (item.result_type == "pdf") {

                            $.post("getPdfToImage", {fileId: item.event_result}, function (data) {
                                $scope.pdfImages = data;
                                $scope.$apply();
                            })
                            // $scope.pdfSrc = 'getPdf?fileId=' + item.event_result;

                        } else if (item.result_type == "video") {

                            $scope.videoSrc = 'getVideo?fileId=' + item.event_result;

                        } else if (item.result_type == 'table') {
                            $scope.imageDetailStatus = false;
                            if (item.data_type == 'lis_detail') {

                                $scope.showId = "mod3";

                                $.post("getLisResult", {pk: item.pk}, function (data) {

                                    if (data) {
                                        $("#mod3").show();
                                        $scope.lisResults = data;
                                        $scope.$apply();
                                    }
                                })
                            }

                        } else {
                            $scope.imageDetailStatus = false;
                            base.post("getResult", {pk: item.pk, type: item.result_type,fileId: item.event_result}).get(function (data) {

                                if (data) {
                                    if (item.result_type == 'html') {


                                        $scope.showId = "mod4";

                                        $(".mod-4").html(unescape(data));
                                        setTimeout(function () {
                                            $(".series_institution").parent().prependTo($("#paper"));
                                        }, 500);
                                    } else {
                                        $scope.showId = "mod1";

                                        $scope.results = data.split("@");

                                    }

                                }
                            })
                        }
                    })

                }
                $scope.searchData = function (name) {

                    base.post("getMobileDetailFilter", {host_id: $scope.host_id, event_name: name}).get(function (data) {
                        $scope.details = data;
                    })
                }







                if ($scope.host_id && $scope.host_id != 'null') {
                    $scope.getDetail();
                }


            })



</script>
